package com.quantumoctopus.magiceatball;

import java.util.ArrayList;

import android.app.Activity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;

public class LogArrayAdapter extends ArrayAdapter<String> {

	private Activity context;
	private ArrayList<String> names;

	public LogArrayAdapter(Activity context, ArrayList<String> names) {
		super(context, R.layout.log_row_layout, names);
		this.context = context;
		this.names = names;

	}

	@Override
	public String getItem(int position) {
		return names.get(position);
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {

		LayoutInflater inflater = context.getLayoutInflater();
		View rowView = inflater.inflate(R.layout.log_row_layout, null);

		TextView nameView = (TextView) rowView.findViewById(R.id.nameView);
		nameView.setText(names.get(position));

		return (rowView);
	}

}
